<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<?php
$layout = explode('&&&', file_get_contents('layout.html'));
echo $layout[0];

session_start();
if (!(isset($_SESSION['username'])))
	header("location:login.php");
?>

<html>
<body>

<!-- Begin Main Column -->

<div id="mainContent">
<?php			
            ob_start();
			$host="localhost"; // Host name
			$username="root"; // Mysql username
			$password=""; // Mysql password
			$db_name="rtl"; // Database name

			// Connect to server and select databse.
			mysql_connect("$host", "$username", "$password")or die("cannot connect");
			mysql_select_db("$db_name")or die("cannot select DB");
			$workshop_id = $_GET['id'];

			echo "Participants added in this workshop:<br>";
			$participant_by_name = mysql_query("SELECT p.PARTICIPANTID, p.FIRSTNAME, p.LASTNAME, p.CITY, p.ADDRESS, p.PHONENO FROM 	PARTICIPANTS p, WORKSHOP w, WORKSHOPPARTICIPANTS wp WHERE w.WRKSPID = wp.WRKSPID AND wp.PARTICIPANTID = p.PARTICIPANTID AND W.WRKSPID = $workshop_id ORDER BY p.LASTNAME, p.FIRSTNAME");
			$NoParticipants=mysql_num_rows($participant_by_name);
			echo "<table border='1'>";
  			echo "<tr> <th>First Name</th> <th>Last Name</th> <th>City</th> <th>Address</th> <th>Phone number</th>";
  			//keeps getting the next row until there are no more to get
			while($row = mysql_fetch_array($participant_by_name))
			{
				// Print out the contents of each row into a table
			$participant_id=$row['PARTICIPANTID'];
				echo "<tr><td>";
				echo $row['FIRSTNAME'];
				echo "</td><td>";
				echo $row['LASTNAME'];
				echo "</td><td>";
				echo $row['CITY'];
				echo "</td><td>";
				echo $row['ADDRESS'];
				echo "</td><td>";
				echo $row['PHONENO'];
			}
			echo "</table><br>";
			echo "Total # of Participants: $NoParticipants";

?>
</div>

<?php
echo $layout[1];
?>

</body>
</html>